import { createStore } from 'vuex'
import createPersistedState from 'vuex-persistedstate'

export default createStore({
  state: {
    isGetterRouter: false,
    isCollapsed: false,
    userInfo: {}
  },
  getters: {
  },
  mutations: {
    changeUserInfo(state, value){
      state.userInfo = {
        ...state.userInfo,
        ...value
      }
    },
    changeGetterRouter(state, value){
      state.isGetterRouter = value
    },
    changeCollapsed(state){
      state.isCollapsed =!state.isCollapsed
    },
    clearUserInfo(state){
      state.userInfo = {}
    }
  },
  actions: {
  },
  modules: {
  },
  plugins: [createPersistedState({
    paths: ["isCollapsed", "userInfo"] // 添加对象，包含只需要持久化的参数
  })]
})
